﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace YXShop.Web.membercenter.individualinfo
{
    public partial class fundlist : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {  
                int uid = ChangeHope.WebPage.PageRequest.GetQueryInt("uid");
                this.litCapital.Text = GetCapitalList(uid);
            }
        }

        #region 银行资金明细
        /// <summary>
        /// 银行资金明细
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string GetCapitalList(int id)
        {
            ChangeHope.WebPage.Table table = new ChangeHope.WebPage.Table();
            YXShop.BLL.Member.UserinAndExp expBll = new YXShop.BLL.Member.UserinAndExp();
            ChangeHope.DataBase.DataByPage dataPage = expBll.GetList(" uid=" + id + " ");
            table.AddHeadCol("", "交易时间");
            table.AddHeadCol("", "交易方式");
            table.AddHeadCol("", "收入资金");
            table.AddHeadCol("", "支出资金");
            table.AddHeadCol("", "银行名称");
            table.AddHeadCol("", "备注/原因");
            table.AddHeadCol("", "状态");
            table.AddRow();
            if (dataPage.DataReader != null)
            {
                while (dataPage.DataReader.Read())
                {
                    table.AddCol(dataPage.DataReader["notedate"].ToString());
                    table.AddCol(GetOutType(Convert.ToInt32(dataPage.DataReader["remitmode"])));
                    table.AddCol(dataPage.DataReader["incomeandexpstate"].ToString() == "0" ? dataPage.DataReader["adsummoney"].ToString() : "");
                    table.AddCol(dataPage.DataReader["incomeandexpstate"].ToString() == "1" ? dataPage.DataReader["adsummoney"].ToString() : "");
                    table.AddCol(dataPage.DataReader["remitbank"].ToString());
                    table.AddCol(dataPage.DataReader["remark"].ToString());
                    table.AddCol(dataPage.DataReader["state"].ToString() == "0" ? "确认" : "未确认");
                    table.AddRow();
                }
                string view = table.GetTable() + dataPage.PageToolBar;
                dataPage.Dispose();
                dataPage = null;
                return view;
            }
            else
            {
                return "没有找到相关信息";
            }


        }
        #endregion

        #region 支付方式
        public string GetOutType(int typeId)
        {
            string str = "";
            switch (typeId)
            {
                case 1:
                    str = "银行汇款";
                    break;
                case 2:
                    str = "虚拟货币";
                    break;
                case 3:
                    str = "现金支付";
                    break;
                default:
                    break;
            }
            return str;
        }
        #endregion
    }
}
